package com.r2coding.security;

import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

/**
 * @author: 98k灬
 * @since: 2022/11/04
 * @email: 98k_style@sina.com
 * @公众号: 爪哇Guy灬
 **/
@Slf4j
@Component("customMobileUserDetailService")
public class CustomMobileUserDetailService implements UserDetailsService {

    @Override
    public UserDetails loadUserByUsername(String mobile) throws UsernameNotFoundException {
        log.error("请求的手机号码 : " + mobile);
        return new User(mobile, "", true, true, true, true, AuthorityUtils.commaSeparatedStringToAuthorityList("ADMIN"));
    }
}
